package com.dwxt.mall.controller;

import com.dwxt.common.base.BaseResult;
import com.dwxt.mall.entity.ProductCategory;
import com.dwxt.mall.service.ProductAttrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/mall/attr")
@RestController
public class ProductAttrController {
    @Autowired
    private ProductAttrService productAttrService;

    /**
     * showdoc
     *
     * @return {"status":200,"msg":"SUCCESS","data":[{"id":1,"name":"日常用品"},{"id":2,"name":"体育用品"},{"id":3,"name":"重庆有线"},{"id":4,"name":"卡卷礼包"}]}
     * @catalog 商城/商品
     * @title 查询所有商品种类
     * @description 查询所有商品种类
     * @url /mall/attr/selectProductCategoryList
     */
    @RequestMapping("/selectProductCategoryList")
    public BaseResult selectProductCategoryList() {
        List<ProductCategory> productCategoryList = productAttrService.selectProductCategoryList(null);
        return BaseResult.ok(productCategoryList);
    }


    /**
     * showdoc
     *
     * @return {"status":200,"msg":"SUCCESS","data":[{"id":1,"name":"日常用品"},{"id":2,"name":"体育用品"},{"id":3,"name":"重庆有线"},{"id":4,"name":"卡卷礼包"}]}
     * @catalog 商城/商品
     * @title 由专区查询商品种类
     * @description 由专区查询商品种类
     * @url /mall/attr/selectProductCategoryByModule
     */
    @RequestMapping("/selectProductCategoryByModule")
    public BaseResult selectProductCategoryByModule(String module) {
        List<ProductCategory> productCategoryList = productAttrService.selectProductCategoryList(module);
        return BaseResult.ok(productCategoryList);
    }

}
